# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=hfd-service
pkgver=0.2.1
pkgrel=0
pkgdesc="Service that manages human feedback devices on mobile devices"
url="https://gitlab.com/ubports/development/core/hfd-service"
arch="all"
license="LGPL-3.0-only"
depends="accountsservice"
makedepends="
	accountsservice-dev
	cmake-extras
	eudev-dev
	lomiri-deviceinfo-dev
	qt5-qtbase-dev
	qt5-qtfeedback-dev
	samurai
	"
subpackages="$pkgname-openrc"
source="https://gitlab.com/ubports/development/core/hfd-service/-/archive/$pkgver/hfd-service-$pkgver.tar.gz
	hfd-service.initd
	0001-Add-missing-include-unistd.patch
	"
options="!check" # No tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DENABLE_LIBHYBRIS=OFF
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm755 "$srcdir"/hfd-service.initd "$pkgdir"/etc/init.d/hfd-service

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}

sha512sums="
10aa989fbd22557aebd409643ada339dcc3a8f00ea65192c17f22b6a7e84699292f45abea545b71045f7ace1b6ca75a34a01912160d3eb5209b7796745a84bab  hfd-service-0.2.1.tar.gz
f82f84a3d0422845d96fa98a74d4614f3097b1e27ff9abaf2b673d9dc802fbca5f077862a055241cc9cb3d9cd161608853069730fb53eff70cb596ebfeeb9a9e  hfd-service.initd
08f311f009245bb90213975ff3c732713860fd786c72417a0c373ca3b70133b2140c7c0596eeec316aa0f4973d0c262b70145d23543e611ddd238311996abb4d  0001-Add-missing-include-unistd.patch
"
